def sequential_search(arr, target):
    for i in range(len(arr)):
        if arr[i] == target:
            return i
    return -1  # 如果未找到，返回-1


arr = [4, 2, 5, 6, 2, 43, 6, 5, 8]
target = 5

result = sequential_search(arr, target)

if result != -1:
    print(f"目标元素{target}的索引为{result}")
else:
    print(f"目标元素{target}在数组中未找到")
